Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Trigrids

A trigrid is a rectangular grid composed of triangular facets. The triangulation should be serpentine (that is, quadrilaterals are divided into triangles in an alternating fashion) to reduce shading artifacts when using Gouraud or Phong shading. Figure 26 shows a trigrid.

Figure 26 A trigrid

The entire trigrid can have a set of attributes. You may specify an array of attributes that apply to each facet of the trigrid. In this way, for example, you can give each facet of the trigrid a different color. In addition, any or all of the vertices can have a set of attributes.

A trigrid is defined by the TQ3TriGridData data type. See "Creating and Editing Trigrids" for a description of the routines you can use to create and edit trigrids.

typedef struct TQ3TriGridData {
    unsigned long                       numRows;
    unsigned long                       numColumns;
    TQ3Vertex3D                         *vertices;
    TQ3AttributeSet                     *facetAttributeSet;
    TQ3AttributeSet                     triGridAttributeSet;
} TQ3TriGridData;
numRows
The number of rows of vertices.
numColumns
The number of columns of vertices.
vertices
A pointer to an array of vertices. The first vertex in the array is the lower-left corner of the trigrid. The vertices are listed in a rectangular order, first in the direction of increasing column and then in the direction of increasing row. The number of vertices is the product of the values in the numRows and numColumns fields.
facetAttributeSet
A pointer to an array of facet attribute sets. If this value is not NULL , the array should contain 2  (( numRows  - 1)  ( numColumns  - 1)) elements.
triGridAttributeSet
A set of attributes for the trigrid. The value in this field is NULL if no trigrid attributes are defined.

© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |